from django.contrib import admin
from mezzanine.pages.admin import PageAdmin
from article.models import Category, Article, SyncSource, CategoryRoot


class ArticleAdmin(admin.ModelAdmin):
    list_display = ('title', 'slug', 'author', 'featured', 'cover')
    list_filter = ('categories', 'author', 'featured')
    search_fields = ('title',)


class SyncSourceAdmin(admin.ModelAdmin):
    list_display = ( 'source_name', 'sync_source', 'sync_hook')
    list_filter = ('source_name', 'sync_hook')
    search_fields = ('source_name', 'sync_hook', 'sync_source')


admin.site.register(Category, PageAdmin)
admin.site.register(CategoryRoot, PageAdmin)
admin.site.register(Article, ArticleAdmin)
admin.site.register(SyncSource, SyncSourceAdmin)